package org.example.config.satoken;

import cn.dev33.satoken.stp.StpInterface;
import org.example.service.application.SysPermissionApplicationService;
import org.example.service.application.SysRoleApplicationService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class StpInterfaceConfig implements StpInterface {
    @Resource
    private SysRoleApplicationService sysRoleApplicationService;
    @Resource
    private SysPermissionApplicationService sysPermissionApplicationService;
    @Override
    public List<String> getPermissionList(Object loginId, String loginType) {
        return sysPermissionApplicationService.selectPermissionByUserId(Long.parseLong((String) loginId));
    }

    @Override
    public List<String> getRoleList(Object loginId, String loginType) {
        return sysRoleApplicationService.selectRoleListByUserId( Long.valueOf((String) loginId) );
    }
    
}
